<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
html,body {
	margin: 0;
	padding: 0;
	border: 0;
	width: 100%;
	height: 100%;
}
</style>
<script src="../scripts/boot.js" type="text/javascript"></script>
</head>

<body>
	<div class="mini-toolbar">
        <a class="mini-button" plain="true" onclick="search" iconcls="icon-find">查询</a>
	</div>
	<div class="mini-fit"><!-- onrowdblclick="edit" 双击事件 -->
		<div id="datagrid1" class="mini-datagrid" allowResize="false" pageSize="20" url="eventListData"
			style="width:100%;height:100%;" borderStyle="border-top:none;" idField="id" multiSelect="true"
		>
			<div property="columns">
				<div type="checkcolumn"></div>
				<div field="taskName" width="100" headerAlign="center" align="left" allowSort="false">任务名称</div>
				<div field="total" width="100" headerAlign="center" align="left" allowSort="false">总案件数</div>
				<div field="overdueDays" width="100" headerAlign="center" align="left" allowSort="false">逾期天数</div>
				<div field="avgDays" width="100" headerAlign="center" align="left" allowSort="false">平均天数</div>
			</div>
		</div>
	</div>
<script type="text/javascript">
var basepath = window.location.pathname + "/../";
//初始化
mini.parse();
var grid = mini.get("datagrid1");
grid.load();
//筛选
function search(){
	mini.open({
		url : basepath+"search",
		title : "筛选",
		width : 750,
		height : 500,
		allowResize : false,
		ondestroy : function (action) {
			if(action == "search"){
				var iframe = this.getIFrameEl();
				var data = iframe.contentWindow.GetData();
				data = mini.clone(data);
				data.createTimeStart = mini.formatDate(data.createTimeStart, "yyyy-MM-dd HH:mm:ss");
				data.createTimeEnd = mini.formatDate(data.createTimeEnd, "yyyy-MM-dd HH:mm:ss");
				grid.load(data);
			}
		}
	});
}
//导入Excel
function importExcel() {
	mini.open({
		url : basepath+"import",
		title : "导入交易记录数据",
		width : 400,
		height : 200,
		allowResize : false,
		ondestroy : function (action) {
			if(action='ok'){
				grid.reload();
			}
		}
	});
}
//导出Excel
function exportExcel(){
	mini.confirm("确定导出记录？", "导出",
		function (action) {
			if (action == "ok") {
				executeExport();
			} else {
			}
		}
	);
}
//执行导出
function executeExport(){
	var data = grid.getLoadParams();
	mini.mask({
		el: document.body,
		cls: 'mini-mask-loading',
		html: '正在导出...'
	});
	$.ajax({
		url : "export",
		type : "post",
		data : data,
		dataType : "json",
		success : function(resultBean) {
			mini.unmask();
			if(resultBean.res){
				window.location.href = resultBean.data;
			}else{
				mini.alert(resultBean.msg);
			}
		},
		error : function(redata) {
			mini.unmask();
		}
	});
}

</script>
</body>
</html>
